﻿using Sowrk03_28.Repository.Interface;
using Swork03_28.Domain.TraceableInfos;
using Swork03_28.Services.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Swork03_28.Services.Impls
{
    public class TraceableService : ITraceableService
    {
        private readonly ITraceablesRepository traceablesRepository;

        public TraceableService(ITraceablesRepository traceablesRepository)
        {
            this.traceablesRepository = traceablesRepository;
        }

        public async Task<List<Traceables>> AllAsync()
        {
            return await traceablesRepository.AllAsync();
        }

        public async Task<int> CreateAsync(Traceables entity)
        {
            return await traceablesRepository.CreateAsync(entity);
        }

        public async Task<int> DeleteAllAsync(List<Traceables> t)
        {
            return await traceablesRepository.DeleteAllAsync(t);
        }

        public async Task<int> DeleteAsync(Traceables entity)
        {
            return await traceablesRepository.DeleteAsync(entity);
        }

        public async Task<Traceables> GetAsync(int id)
        {
            return await traceablesRepository.GetAsync(id);
        }

        public async Task<List<Traceables>> GetValues(Expression<Func<Traceables, bool>> expre)
        {
            return await traceablesRepository.GetValues(expre);
        }

        public async Task<int> UpdateAsync(Traceables entity)
        {
            return await traceablesRepository.UpdateAsync(entity);
        }
    }
}
